package com.wkq.util.transformer

import android.view.View
import androidx.viewpager2.widget.ViewPager2

/**
 *
 *@Author: wkq
 *
 *@Time: 2025/7/28 17:59
 *
 *@Desc: 缩放进场 + 淡入淡出（ScaleInOutTransformer）
 */
class ScaleInOutTransformer : ViewPager2.PageTransformer {
    override fun transformPage(view: View, position: Float) {
        val scale = 1f - kotlin.math.abs(position) * 0.3f
        view.scaleX = scale
        view.scaleY = scale
        view.alpha = 1f - kotlin.math.abs(position) * 0.5f
        view.translationX = -position * view.width * 0.2f
    }
}
